<form action="file/doUpload" method="post" autocomplete="off" enctype="multipart/form-data" class="pageForm required-validate" onsubmit="return iframeCallback(this, $.bringBack)">
    <input type="hidden" name="_csrf" value="<@tools.csrfToken admin=true/>"/>
    <input type="hidden" name="field" value="${field!'fileName'}"/>
    <input type="hidden" name="originalField" value="${originalField!}"/>
    <div class="pageFormContent layoutBox" layoutH>
        <div class="tabs">
            <div class="tabsHeader">
                <div class="tabsHeaderContent">
                    <ul>
                        <li><a href="javascript:;" class="tabImageBtn" onclick="$('button[type=submit]',$.pdialog.getCurrent()).show();return false;"><@t.page 'file'/></a></li>
                        <li><a href="javascript:;" onclick="$('button[type=submit]',$.pdialog.getCurrent()).hide();return false;"><@t.page 'upload.log'/></a></li>
                        <li><a href="common/file_list.html?field=${(field?url)!}&originalField=${(originalField?url)!}&fileTypes=${fileTypes!}" class="j-ajax" onclick="$('button[type=submit]',$.pdialog.getCurrent()).hide();return false;"><@t.page 'webfile'/></a></li>
                    </ul>
                </div>
            </div>
            <div class="tabsContent unitBox">
                <div class="pageContent">
                    <#if fileTypes?has_content&&'image'=fileTypes>
                        <div class="upload-wrap">
                            <input type="file" name="file" accept="image/*" class="valid" style="left: 0px;">
                            <input type="hidden" name="base64File"/>
                            <input type="hidden" name="originalFilename"/>
                            <div class="cutinput">
                                <input name="width" type="number" value="${width!300}"/>
                                <span>*</span>
                                <input name="height" type="number" value="${height!300}"/>
                            </div>
                        </div>
                    <#else>
                        <input type="file" name="file" class="required" size="30"<#if fileTypes?has_content&&'video'=fileTypes> accept="video/*"</#if>/>
                    </#if>
                </div>
                <div class="pageContent">
            <@log.uploadList userId=admin.id fileTypes=fileTypes pageIndex=1 pageSize=21>
                <#list page.list as a>
                    <div class="image-list">
                        <#if 'image'=t.fileType(a.filePath)>
                            <img src="${site.sitePath+a.filePath}" alt="${a.originalName!}" title="${a.originalName!}">
                            <a href="javascript:;" class="edit-icon" onclick="$('.tabImageBtn',$.pdialog.getCurrent()).click();$('div.upload-wrap', $.pdialog.getCurrent()).editImg({imgUrl:'${site.sitePath+a.filePath!}',imgName:'${(a.originalName?has_content)?then(a.originalName,a.filePath!)}'});return false;"></a>
                        <#else>
                            <i class="thumb icon-file-alt icon-large"></i>
                        </#if>
                        <p title="<@t.page 'width'/>:${a.width!},<@t.page 'height'/>:${a.height!}">
                            <a href="javascript:;" onclick="$.bringBack({'${field!'fileName'}':'${a.filePath!}','fileType':'${a.fileType!}','fileSize':'${a.fileSize!}','width':'${a.width!}','height':'${a.height!}','${originalField!'originalName'}':'${a.originalName!}'});return false;">
                                ${(a.originalName?has_content)?then(a.originalName,a.filePath!)}<#if a.fileSize?has_content>(${a.fileSize})</#if>
                            </a>
                        </p>
                    </div>
                </#list>
            </@log.uploadList>
                </div>
                <div id="fileBox">
                </div>
            </div>
        </div>
    </div>
    <div class="formBar">
        <ul>
            <li><button type="submit" class="buttonActive" title="ctrl+s"><@t.page 'upload'/></button></li>
            <li><button type="button" class="button" onclick="$.bringBack({'${field}':''});return false;"><@t.page 'button.clear_select'/></button></li>
            <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
        </ul>
    </div>
</form>